home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows Expert
/
Windows Expert.iso
/
desktop
/
bmp2bgi.zip
/
BMP2BGI.TXT
< prev
next >
Wrap
Text File
|
1991-05-25
|
5KB
|
110 lines
BMP2BGI: A utility to convert BMP graphic images to BGI format.
Version: 1.0
Date of Release: 6/25/91
===========================================================================
This utility will convert 16-Color BMP images, like the ones drawn
with MS Windows PAINT, to BGI format, so that the BGI image can be accessed
through your Borland programs. Any image of any size can be accommodated
as long as its size does not exceed the size of your video card. 1024x768
images will not be converted if your video card can only show 640x480.
The BMP images must be in uncompressed format, 16-color, and not
created through OS/2. These are the MS Windows 3.0 defaults. A later
version of BMP2BGI will support 256-color images.
The advantage of this is that now you can use a paint program
better than one you could create yourself and convert the image to use
in your Turbo Pascal, C, or C++ programs via the getimage() or putimage
functions. I found this to be helpful for writing games, creating neat-o
title screens, and so forth. Granted, BGI is not the fastest nor most
convenient of graphics system, but it's free. Not many of us hobbyists can
afford the SFX graphics library.
To convert your BMP file, create it & save it. Then, on the DOS
line, type:
BMP2BGI FName.BMP
where 'FName.BMP'is the BMP file. Next, you will see some statistics about
your file, and EITHER an error message that explains why the image couldn't
be translated OR a message that informs you that conversion will commence.
The conversion is nondestructive, i.e., your BMP file will be unchanged.
Then you will see the image on-screen, followed by black-masking as the
image is converted. The image is saved in the file 'FName.BGI', where 'FName'
is the same 'FName' as your BMP file. If FName.BGI already exists, it is
written over. Simple, yes?
If you are interested in reverse-engineering BMP2BGI, I made it easy
for you; I included all source code and project files. NOTE: if you want to
tinker around w/ BMP2BGI: the source code is in Turbo C++ (v1.0) and you will
need to write your own fexist(char *) function that returns TRUE if a file
exists or FALSE otherwise. Of course, you could comment out the part of the
source code that calls fexist(), as this won't affect the xlation.
The BGI file is not exactly pure BGI, as there is a header before the
BGI bitmap images that contains various info. Refer to BGI.H (included w/
BMP2BGI) for an explanation. IT IS IMPORTANT THAT YOUR BORLAND PROGRAMS USE
BGI.H TO ACCESS BGI IMAGES CREATED W/ BMP2BGI. A sample program, SHOWBGI.EXE,
and accompanying source code is included to show you how.
I acknowledge Charles Petzold's informative article on
BMP bitmaps as giving guidance if not outright variable names and BMP header
structures. If you are interested in the BMP file, refer to Mr.Petzold's
article in PC Magazine (vol.10(10), pp365-370).
Included in this Zip-archive are the following files:
0. This file:
BMP2BGI.Txt
1. Turbo C++ source code for BMP2BGI:
bmp2bgi.c, bmp2bgi1.c, bmp2bgi2.c, bmp2bgi3.c
bmp2bgi.prj (The project file for BMP2BGI)
bgi.h, bmp.h (Header files for BMP and BGI image files)
2. Turbo C++ source code for displaying BGI images created w/ BMP2BGI:
showbgi.c, showbgi2.c
showbgi.prj (The project file for SHOWBGI)
3. Compiled Executables if you want to use the BMP2BGI right away:
bmp2bgi.exe, showbgi.exe
4. And a sample BMP file:
test.bmp
COPYRIGHTS (Because a lawyer suggested I do this):
============================================================================
BMP.H: (c) Ziff-Davis Publishing
BMP2BGI.EXE, SHOWBGI.EXE, BMP2BGI.c..BMP2BGI3.C, BGI.H, SHOWBGI.EXE,
SHOWBGI.C, SHOWBGI2.C, TEST.BMP: (c) R.G.Rasulis Consulting Services
MS Windows 3.0, MS Windows Paint, BMP: (c) Microsoft, Corp.
Turbo C++, Turbo Pascal, Turbo C, BGI: (c) Borland International.
About the Author:
============================================================================
Richard Rasulis, Jr. is currently earning his doctoral degree in clinical
psychology at the University of Montana. Prior to becoming a "gradual"
student, he worked as a hacker-4-hire in Boston, MA. Amongst his hobbies is
programming as well as conducting research on using computers to administer
psychological tests. He is the author of several PC programs, including
scoring programs for various psychological tests. Further, he is conducting
research in the area of maturity and psychological well-being. He may be
contacted through the various addresses:
SnailNet: R.G.Rasulis EduNet: py__rgr@selway.umt.edu
c/o Dep't of Psychology GEnie: R.RASULIS
University of Montana
Missoula, MT 59801